package core.resources
{
import core.Configuration;

import framework.core.AssetsManager;
import framework.view.components.graphics.SWF;

import values.map.MapValue;

/**
 * MapLibResourceTask
 * @author jliang
 *
 */
public class MapLibResourceTask extends LoadTaskBase
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	public function MapLibResourceTask()
	{
		super();
	}
	
	override public function start():void
	{
		if (params.lib)
		{
			complete();
			return;
		}
		
		var vo:MapValue = params.data;
		var url:String = Configuration.assetsPath + vo.lib;
		
		AssetsManager.loadAsset(url, libLoadedHandler, null, SWF.EXTERNAL_LIBS);
	}
	
	private function libLoadedHandler(swf:SWF):void
	{
		params.lib = swf.appDomain;
		
		complete();
	}
}
}